{extend name="admin/b2c/base" /} {block name="resources"/}
<style type="text/css">
.input-append .add-on, .input-prepend .add-on{
	height:22px;
}
</style>
{/block} {block name="right_tab"} {/block} {block name="main"}
<!-- <form class="form-horizontal" id="shouquan"> -->

<div class="smallTitle mt30">
	<span class="text">绑定开发者账号</span><span class="muted">（选填，用于配置自定义菜单）</span>
</div>

<div class="binding">
	<div class="input-prepend control-group">
		<span class="add-on"><i class="icon-user"></i></span> <input
			class="span2" id="appid" placeholder="appID"
			value="{$wchat_config.appid}" type="text"><span
			class="help-inline"></span>
	</div>
	<div class="mt8"></div>
	<div class="input-prepend control-group">
		<span class="add-on"><i class="icon-lock"></i></span> <input
			class="span2" id="appsecret" type="text" placeholder="Appsecret"
			value="{$wchat_config.appsecret}"><span class="help-inline"></span>
	</div>
	<p class="muted mt8">
		AppID以及Appsecret来自于您申请开发接口时提供的账号和密码。
		<!--<a class="ahelp"
				href="/admin.php/UserManage/WeiXinHelp02?HeadCode=10000&amp;MenuCode=10060">
 				<i 
				class="icon-help-blue" 
 				style="background: url(/public/admin/images/bluequestion.png) no-repeat -6px -8px;"></i> 
				详细绑定步骤</a>-->
	</p>
</div>

<div class="smallTitle mt30">
	<span class="text">服务器配置</span><span class="muted">（用于接收用户消息）</span>
</div>

<div class="serve">
	<dl>
		<dt>URL:</dt>
		<dd>
			<input class="text" style="background-color: white; border: none;min-width: 400px;display: inline-block;"
				readonly="readonly" id="empowerUrl" value="{$call_back_url}">
			<button onclick="JScopy('empowerUrl')" type="button" class="btn">复制</button>
		</dd>
		<dt>Token:</dt>
		<dd>
			<input class="text" style="background-color: white; border: none;min-width: 400px;display: inline-block;"
				id="empowerToken" readonly="readonly" value="TOKEN">
			<button onclick="JScopy('empowerToken')" type="button" class="btn">复制</button>
		</dd>
	</dl>
	<p class="muted">
		请将以上URL及Token填到微信公众平台中，以完成绑定。
		<!-- 		<a class="ahelp"
				href="/admin.php/UserManage/WeiXinHelp01?HeadCode=10000&amp;MenuCode=10060"
				>
		<i class="icon-help-blue" style="background: url(/public/admin/images/bluequestion.png) no-repeat -6px -3px;"></i> 
				
				详细绑定步骤</a>-->
	</p>
</div>
<div class="smallTitle mt30">
	<span class="text">设置业务域名</span><span class="muted">（设置业务域名，用户在相应域名上进行输入时不再出现防欺诈盗号等安全提示）</span>
</div>

<div class="setdomain">
	<p class="titlestep">
		<a href="https://mp.weixin.qq.com/" target="_blank">登录微信公众平台</a>点击公众号设置&gt;功能设置&gt;业务域名设置，一次填写：
	</p>
	<p class="text-success">
		<span class="muted">域名1：</span>{$url}
	</p>
	<p class="titlestep mt30">
		<a href="https://mp.weixin.qq.com/" target="_blank">登录微信公众平台</a>点击公众号设置&gt;开发者中心&gt;网页授权获取用户基本信息&gt;修改：
	</p>
	<p class="text-success">
		<span class="muted">填写授权回调页面域名：</span>{$url}
	</p>
	<p>业务域名设置完毕！</p>
</div>
<p class="button mt20">
	<button class="edit_button" onclick="save()">保存</button>
	<input type="hidden" id="IsChange" value="true">
</p>
<!-- </form> -->

{include file="admin/b2c/openDialog" /}
<script>
	function save() {
		var appid = $("#appid").val();
		var appsecret = $("#appsecret").val();
		$.ajax({
			type : "post",
			url : "ADMIN_MAIN/Wchat/setInstanceWchatConfig",
			data : {
				"appid" : appid,
				"appsecret" : appsecret
			},
			success : function(res) {
				if (res.code > 0) {
					showMessage('success', res["message"]);
				} else {
					showMessage('error', res["message"]);
				}
			}

		});
	}
	function JScopy(obj){
		var url = document.getElementById(obj);
		url.select();
		document.execCommand("Copy");
	}
</script>
{/block}